Fix potential infinite loop in inclusion hierarchy code. Fixes #136