bug fixes for no result to sql query