Fix patching failures when updating a class multiple times

Signed-off-by: Ross Allan <rallanpcl@gmail.com>