Fixed `sed' errors

Also:
- Quote variables to properly handle spaces in values