fixed a lot of db-related stuff.