Fixed database concurrency issue.