fix condition check