fix bug in if condition