fix bug when students have infinite loop