More CodeGenerator bug fixes