fix bug with if condition