Fixed bug with code generation