modify the code of patch