Fixed NullPointerExceptions for getCanonicalName() calls