fix type() for singletons
throw when applying anonymous class