fixed search if no results which was throwing 500 error on fetchall