client code review and adddevice issue