Fixes from code review on #1161
Merge pull request #1202 from penguinho/udidetect

Fixes from code review on #1161