Here is what I did in code base 2.2.6
Not sure whether it matters, but do you have any valid reason for working with code released 5 years, 8 months ago? We're now at 2.4.19. I'd recommend you check whether recent code suffers from the same problems, and eventually discuss fixes/improvements that apply to the latest code, in order for fixes to be considered.
p.