Fix sequence number validation logic

Sequence number validation now accounts for wrapping