Add additional tests. Fix uncovered bugs.

Fix issue with the warning message not referring to the object's actual
class.
Fix issue dealing with protected methods in subclasses.