Fix code generation of exception