stash: improve robustness of the stash rename command