Fix NoneType error when reading global Env.