Fix an error that occurs if uid is not set

This shouldn't happen normally but let's cover it anyway.