Fixed undefined error in db.js