Fixing automatic udid detection

Fix #1399
Merge pull request #1493 from penguinho/fix_udidetect

Fixing automatic udid detection