fixed database connection resetting