Compatibility fix for Python3