correct minor bugs in main.cc