GRIND-49: fixed a variable out of scope problem

Change-Id: Iaed86492ae70995e10bd1ff141ecdfb87855085e