key copy logic