fixed search and sort issues