Fix scoping rules for dictionaries.

Refs #6183