fix the bug in main.cpp