Fix some bug & add Device lock