Fix SQL errors caused by sender insertion from multiple threads