bugs fixed, db test cases working