More db fixes