Inproved device detection/fixed error