updated persist code