Python 3 fixes

Fixes #18