remember which item was switched to which id, so that later the correct item can be unset
use variable instead of a second array lookup
Merge pull request #1479 from schiesbn/sharing_bug

sharing, unset the right item to avoid false positives during the check if resharing is allowed