Fix: Better sanity checking when determining if a class or class name is valid.