Fix exception on empties

Starting with a fresh database either sqlResults is empty (IndexError) 
and/or last_proper_search is None (TypeError)