Fix #3762 using uid leads to permissions errors