Fix a bug in the indexing of state variables through `VariableView` where indexing with a scalar returned a length-1 array instead of a single value. See #233