fix apply patches