fixed some database stuff