fixed db handling