corrected check condition (2nd pass)