have put_key() write to a temp file for safety