Fix assigning Persistent to Persistent and add test.