fixed bug in collision code