Thanks for reporting this issue and attaching a patch! I'd like to clarify which release you are seeing this behaviour on, as my understanding of upstream is that it was resolved in their trunk ~2 years ago. I would have expected this to be fixed in a later release of ubuntu when the upstream fix reached us.
However, if this is not the case - we need to investigate further. Marking Incomplete pending clarification where this behaviour is being witnessed.