resetFlag removed because of problems in implementation. (checked with Maxim)