fix environmental indexing bug