Fixed method by which environment is figured out.