Fixing bug in main