Issue 2511: make sure cluster is removed from polymorphicClusterIds

Suggested fix, tested locally.