corrected the checking parameter in case a device is found