fix environmental indexing bug2