Integrate @rmalecki patch to avoid problems parsing large integers

This is basically #12 with some minor formatting changes.