Fixed bug where events were being kept, making the previous commit not fix anything.
Fixed bug where program will crash if REPEAT_ON_FAIL is set to false.