Better patching mechanism for PersistenceHelper and a bunch of tests.