Fix nasty refactor bug