fix patch generation