I take it you’re putting that shortcode into your template somehow? Are you using do_shortcode() to call it?
I understand it’s working now, but I ask because $cat will only work in PHP, not in a shortcode that you insert into a post.
I’d be happy to take a look. I’ll need to have 2.38.9 installed so I can see the problem. Is it OK if I login and install it for testing? You sent me a login a while back.