fixed bug where empty search returns internal server error