correcting writeArray()