Tweaks to database stuff, still errors