Fixed to adapt to new signature of to_bytes