bugfixes

query with no rows returned fix