Fix a newly introduced exception thrown when connecting with auto-connect