Fixed bug in collision code