imho, you should offset this by the total number of errors, otherwise you might hit an infinite loop when number of error reach $limit