Several fixes to index to solve the pegparser bug