db error log addition, db connection bug fix