fixed the issue in removing duplicate items, fixes #356