Refs #3809 - fix shadowing outer local variables