Python 3 support, fixes #38