fixed main.cpp code