refactor serializer to use Bytes instead of ByteBuffer