Restore panic check at and of the loop. Thanks! Don for noticing this.