Attempt to fix bug reported in PR 791 : a race condition in ConnectionManager and Connection