Fix undefined variable

88399f3 introduced an undefined variable, this fixes that.
Merge pull request #6723 from terminalmage/issue6656

Fix undefined variable
Merge pull request #6726 from s0undt3ch/develop

Jenkins pylint reported fixes.