check if next is defined