Fixing UID being nil

UID is returned as nil.This should fix it. Patch is untested
Test to ensure UID is not nil
Merge pull request #1 from samdunne/patch-1

Fixing UID being nil