Fixes Python 3 compilation errors