Fix bugs in models toByteString.