Fix rare bug in pf logic