Fixed critical error in collision counting