Fixing automatic udid detection

Fix #1399