Fix compilation errors on Python 2