Fixed issues with client connections being incorrectly created