corrected check condition