More database bugfixing...