fix a bug: if condition lock