Lots more fixes to tests and code to make class-based apps work.