Fixed a severe variable scoping error in Program and Kernel tests