bug in condition check