Fixing bug with removing listeners