Fixed nasty, nasty bug corrupting memory behind my back