seems like stream.write(str) without encoding is allowed after all