Fixed broken tests and added event on end.