Made sure the environment is set before the site components are loaded

Closes #321
Resolved timing issues around loading of weblounge bundles

Closes #322