fixed some bugs with out of order sequence numbers