create and apply a patch