The only thing I can see that might be a problem is that you’re not getting the term.
this will show you what you’re getting.
$term = get_queried_object();
echo '<pre>'; print_r($term); echo '</pre>';
Unless it’s something in what you’re using to build your template, this should be working.