       }
 
     $scope.refreshStats = (id) ->
-      return unless (get id)?.power_state is 'Running'
+      if (get id)?.power_state isnt 'Running'
+        refreshControl.cancel()
+        return
+
       return xo.vm.refreshStats id
+
         .then (result) ->
           result.cpuSeries = []
           result.cpus.forEach (v,k) ->


        prepareDiskData mountedIso

        # get the RRDs every 5 sec
        interval = $interval(
          () => $scope.refreshStats(VM.UUID)
          5000
        )
        $scope.$on('$destroy', () => $interval.cancel(interval))
    )

    descriptor = (obj) ->

          push result, arg if arg?
        result

    self = this

    this.baseStatInterval = 5000
    this.statIntervalObject = null

    # Provides a fibonacci behaviour for stats refresh on failure
    refreshControl = {
      baseStatInterval: 5000
      interval: null
      init: () ->
        this.terms = [0,1]
        this.interval = $interval(
          () => $scope.refreshStats($scope.VM.UUID),
          this.baseStatInterval * this._next()
        )
        $scope.$on('$destroy', () =>
          $interval.cancel(this.interval)
          this.interval = null
        )
      _next: () ->
        result = this.terms[0] + this.terms[1]
        this.terms = [this.terms[1], result]
        return result
      next: () ->
        $interval.cancel(this.interval)
        this.interval = $interval(
          () => $scope.refreshStats($scope.VM.UUID),
          this.baseStatInterval * this._next()
        )
      cancel: () ->
        $interval.cancel(this.interval)
        this.interval = null
    }

    $scope.$watch(
      -> get $stateParams.id, 'VM'
      (VM) ->
