Fix scope of setup_provider
Merge pull request #1280 from psav/fix_scope

Fix scope of setup_provider