fix copy key from buffer