some fixes

a. fixed sensor doesn't receive data while creating keys
b. fixed saving new keys clear the old ones first