Fixes #52. Tests were not emulating the correct environment in tests