fix constraints with SubRef and toScala on SubRef

Reference now extends Structure
implicit conversion to Var now operates on abstract class Reference