fixes for handling ssl connections