Fix up conflict handling - make sure we have proper db handle, and record the actual count, not just the existence.