fix(autoload): correct detection of traits in autoload (refs #4713)