fix for infinite loop if device is not available