Fixed to adapt to new signature of to_bytes
Merge pull request #332 from untitaker/sprint-branch

Fixed to adapt to new signature of to_bytes