Pull in the key copying

Pull in key copying and minor fixes from dev