trying to write in ByteArrayOutputStream