Fix incorrect variable scoping

refs #8074