add option to save Persistent ptr