fixed database errors