Fixing issue where undefined returns for a blank query