avoid memory leak by moving unique_ptr, fix swapping wrong rule
avoid memory leak by moving unique_ptr, fix swapping wrong rule

thomastrapp/hext,thomastrapp/hext,thomastrapp/hext,thomastrapp/hext,thomastrapp/hext,thomastrapp/hext,thomastrapp/hext,thomastrapp/hext