Fixed a problem where core.environment was not used in bootstrap() when necessary, fixes #657 (also made that code a little more logical in structure)