Fix for scope error in #2751.
Merge pull request #2827 from jamalex/fix_sprintf_parens

Fix for scope error in #2751.