Int conversion to long in py2.x

Fixing issue #276
python 2.x uses long instead of int, but this raises an issue which I've tried to explain in #283