                   setting.initialize() if angular.isDefined(setting.initialize)
 
                 # Formats the chart when necessary
-                widget.format() if angular.isDefined(widget.format)
+                if angular.isDefined(widget.format)
+                  widget.format()
 
                 deferred.resolve widget
 

          )
      )

    #====================================
    # CRUD methods
    #====================================

    @show = (widget, refreshCache=false) ->
      deferred = $q.defer()

            deferred.reject("trying to load a widget (id: #{widget.id}) that is not in currentDashboard")

          else
            data =
              owner: widget.owner
              sso_session: _self.getSsoSessionId()
              metadata: widget.metadata
              engine: widget.category
            data.refresh_cache = true if refreshCache

            dashboard = ImpacDashboardsSvc.getCurrentDashboard()

