Porting changes for Python 3.3 + fix for issue #13