fix the physics and math bugs