Fix int conversion

This pulls in some of bastibe's upstream changes and a regression fix for python int number conversion.
I would really appreciate if you can merge them (or cherry pick the int number conversion patch if you feel uneasy
about merging bastibe's changes) and upload a new egg to pypi.python.org

Feel free to ask if anything is missing or not clear.

Thanks in advance,
Peter