Fix broken function edit_key