Fix condtion check