Make PatchD more robust to uninitialized variables, also allow it to be reset.
Make PatchD more robust to uninitialized variables, also allow it to be reset.

shentino/kotaka,shentino/kotaka,shentino/kotaka