Python 3 support

Found one small problem in Python 3, everything else works fine