Fixed minor bugs in Unit.java