For convenience, write() returns a byte array instead of a string.
Fixed handling of integer offsets.