Fixes a bug in hasNext() that can cause it to return true when there are no more elements