Fix cvar substitution so that it interacts correctly with quoting and other things