modified create_key