Fix persistency bugs after refactoring