Fixed some issues wrt code generation.