Fixed collision detection, other fixes