fixed bug in main.cpp