Merge "Prevent crash when removing duplicates" into oc-dev