small fix in hasNext (evaluation was being done wrong)