Fix path extraction

Replacing the path was failing if the params (i.e. key) included a dash (-)