Fix the fix of device string check.

Thanks to Jan Kardell.