Fixed a problem where auto downcasting from a smart pointer to a derived class for which no smart pointer was registered would cause a crash.
Now a smart pointer is only downcast to the most derived class which is bound and for which a smart pointer is registered.