Multiple database fixes

don't forget to merge me, yo