Warning and some codestyle fixes in main.cpp

Warning and some codestyle fixes in main.cpp