fix problems with code that resets invoice events