fixed database logging