Fix ReferenceError in OnEndRun.