     true
 
   loadPhyo: (x) =>
+    m = loadedModels[x.model]
     p = new BaseElements.Phyo(@ve.surface.baseRect,
                                x.position.x, x.position.y, x.position.z)
     @setProps(p, x)
     @ve.surface.elements.push(p)
-    m = loadedModels[p.props.model]
     m.instances.push(p)
     p.model = m
     p.loadArgValues()


      if m.props.icon != ''
        @ve.loadIcon(m.props.name, (tex) =>
          m.setIcon(@ve.iconCache[m.props.name])
        )
        true


      @args = []

    setIcon: (x=0, y=0, z=50) =>
      if @parent? and @shp?
        @parent.obj3d.remove(@shp.obj3d)
      @shp = new Shapes.Icon(@tex, x, y, z)
      @shp.obj3d.userData = this
      if @parent?
        @parent.obj3d.add(@shp.obj3d)
      g.ve.render()

    addArgs: () ->
      _args = @model.props.params
