Fix bug in hasnext when no result(s)