ExRem(Buy, Sell) not allowing AllowSameBarExit

I am trying to exit on the same bar as the entry, so I enabled AllowSameBarExit, but after debugging why it was not working, I found that if I comment out:
buy = ExRem( buy, sell );
sell = ExRem( sell, buy );
It will generate the exit for the entry bar, but that also lets through continued buys and sells after the initial one, which I don't want. What is the work-around for this?