fixed search query method