Switched to instanceof check; tested in extension.