Fix compilation failure

Fix failure of compilation caused by referring to an inaccessible local variable.