fixing bug with modes