fix row counting. Properly displays error about empty result set