[WiP] Fixing some database classes

This thing is like the never-ending story.