own patch?

please add some comments on the top: what does it fix, where did you get it, etc.