Fix sed getting confused by / in TMPDIR path

Fix #946. Close #948