support writeAsArray