Fix patching for Python2