Fixed Connection Issue

The test file revealed undefined variables causing the problem