Adding new master key, some thread fixes