Fix class declaration detection

To be able to use something like this:
Application.register class Dispatcher ...