fixes #6275 - idempotence needs clone of original data and to handle *_port
Use Enumerable#find instead of each where possible