Fix database error undefined on Chrome and count returns IDBRequest instead of result