check that we're not off the end of a sequence