Fix to replace large array

Fix #3194