       # """var #{instanceName} = new #{className}(#{listOf methods});"""
       (jsVarDeclaration (validIdentifier instanceName),
         (irDefinition (new Constrained freshConstraints, (tupleOfTypes methodTypes).type),
-          (jsNew className, (join superClassInstances, methods))))
+          (jsNew (validIdentifier className), (join superClassInstances, methods))))
 
 # Makes sure methods are typed explicitly and returns the instance constraint
 # with renamed type variables to avoid clashes

  paramAssigns = allFieldNames.map (name) ->
    (jsAssignStatement (jsAccess "this", name), (validIdentifier name))
  constrFn = (jsFunction
    name: dictName
    params: (map validIdentifier, allFieldNames)
    body: paramAssigns)
  # Not necessary

              body: [(jsReturn (jsNew identifier, paramNames))])])
        else
          (jsNew identifier, []))
      constrFunction = dictConstructorFunction constr.symbol, paramNames
      accessors = dictAccessors constr.symbol, identifier, paramNames, defs.length
      (concat [constrFunction, accessors, [constrValue]]))

