fixes #1109

ToInt64() fails on 32bit machines.
Merge pull request #1110 from remcoros/issue-1109

[RFC] fixes #1109