Fix bug that top-level example's failure causes out of range error