Fix overflows.
Merge pull request #28 from Alcaro/master

Fix overflows.