Fix bug in search function for finding clash