Fixed undefined variable errors that made tests fail

Change-Id: Ic004e0d8d8efe3e4b313b737479b8098aa0048bc