Fix environment being empty initially