Improvements in db_connect