read and write binary when serializing with msgpack

@thatch45, please verify these changes.