initial python3 compatibility, fixed #181