corrected check for empty