Bug fixed in main.cpp