More db error fixing