Added empty string checks as the test to fallback to the diviceID