Add check to see if handle is valid (and not beyond the end)