Fixed bug in device lookup.