fix: in .to_bytes() return type specific bytes
#1341
Merged
.to_bytes() return type specific bytes
#1341