Fix hasNext and next