python3 fix apply_patches