correct the environment check to use the default environment when not specified. Fix pointed out by Caius Howcroft