Fix error and success event handling.