Fix arrays not being cloned properly