Moved ret event after return value check.