Fix: Avoid out-of-index errors.