Fix undefined variable $user in create_key