persist: fix error handling