I would refactor this in a little method which name says it is a hack, since now (just looking at the diff), there is code duplication, and will be easier to remove (function calls and implementation), and easier to test if hack is still needed (temporarily make the function empty)
What do you think ?