Fixed infinite loop bug and seq num reset after timeout