set writeToArray to true