Fixing bug with main