This is the actual fix to the bug. Described in the previous commit.