Fix  variable on if condition