fix bugs in main.java