Fixing bug with removing items from the list