Fixed if code generation error