small bug fixes, db_connect