I usually try jokes to lighten up the class. And try to keep my cool, but sometimes I cannot. I found this advice useful: How to deal with difficult audiences (at http://www.presentation-pointers.com) from the valuable post at presentation zen
I should always remember not to personalize anything when I teach. I usually don’t take it personally, but the times I have gotten into trouble are the times that I do take it personally. Happy and cheerful people (or those who are in class) seem to be the better teachers. It does not mean pandering, either.