Fix missing hasOwnProperty checks in the persistence code