check sequence first before getting the nextValue