fixed use of applyPatches