variable scope is important! Refs #810