Uid variable behaviour unexpected

I’ll see your question as soon as I have time, but if anyone is available to help feel free. I can supplement it if necessary.