make db logic solider
make db logic solider