Variable sort-out

Gets rid of one reference error and uses the unused variable.
Merge pull request #8035 from KA101/buildfix

Variable sort-out