Attempts to fix Python 3 compilation errors