Fix #10: Enhance the connection error handling