fixed errors on code generation