Fix persistence to handle data changes correctly