fixed database issues