Fixed a small bug in db.connect