Fix a memory leak
Remove cached replicas in case they are no longer Unused in the
transformation