Test for db_conn; fix write_error bug; 100% coveragegs