array_new, array_write and tests