fixed database connection