corrections on getpaireddevices function dublicate key bug