Fix an issue surrounding scalar variables and referenced subexpressions. Also explicitly raise a NotImplementedError when trying to use a linked variable with a subexpression -- before it failed with an opaque error message