Fix the logic for getting DeviceUniqueKey