Fix deep array copying