Fixed bug in main