Fix error check in idb