Use correct object to get classes. See #6635