I've missed this bug, but I've posted a patch that is like yours just not as large a change. Hopefully it works for you.