walk_replace: add support for arrays