fixed uid check to be more stand-alone