Fixed else block code generation, and added return action code generation for unit.