Credit: Chris Haston/NBCU Photo Bank

It’s been 13 years since Gene Wilder, who died Sunday, acted on screen; his last role was on Will & Grace in the 2003 episode “Sex, Losers & Videotape.”

In the NBC sitcom’s fifth season, Wilder played Will’s (Eric McCormack) wacky boss, Mr. Stein — a performance that earned an Emmy Award in 2003. His first appearance on the show was in “Boardroom and a Parked Bench,” in which Mr. Stein returns to New York to take over the law firm and makes Will his right-hand man. The Willy Wonka actor’s appearance was met with a standing ovation from the studio audience, but at the time he assumed they did that for all guest stars. In a blooper video that’s made its way onto the internet, McCormack goes off-script, causing Wilder to break.

Wilder made his final appearance on the show later that season. In that episode, Mr. Stein enters into a relationship with Jack’s friend Karen (Megan Mullaly), ruining an anti-romance club the two of them had formed in the wake of Will’s recent breakup.

Although Will & Grace marked Wilder’s last role onscreen, Wilder also lent his voice to an episode of Yo Gabba Gabba! in 2015 and appeared as himself in several projects, most recently the 2016 documentary Celebrating Laughter: The Life and Films of Colin Higgins. He died late Sunday due to complications from Alzheimer’s disease at the age of 83.

Here’s another Will & Grace clip featuring Wilder’s award-winning turn as Mr. Stein: