Write with IndexedDB: a little buggy