Bug fix

Fix global variables to be global again.
Merge branch 'master' into gh-pages