backport of duplicate packet fix