added error checking to makepersistent