fix error handling for connection problem