reduce cpu use, prevent a possible IndexError