fixup db connection code