Fixed bug/errors in main.cpp