Fixed bug in Main