Indexes rules by head, fixes bugs on Earley