fixed database problems