deep replace to clone arrays