Fixed exception if devicetypeid was undefined.