fixed codegen for return values