fix thread safety issue and prevent importing keys to contact accounts