fixed database factory issues