Fix for empty resultsets being handled properly