Fix search and comparing position