Fix concurrent database updates