repaired db handler and some tests