fix db.yaml, tidy some code