fix device number getting bug