add check whether file exists before patching it