Bug fix with expressions

Previously it was possible to have an expression with a name not equal
to what it represents. This was due to a bug, fixed, and discovered due
to another bug, also fixed.