fix some bugs in persistence.js