Fix a bug in collition logic.