Added John's patch to reset the bitfields prior to event handling.