for defensive purposes, need to handle case where cur_index never gets set.