   
   # Initialize a WebFITS object
   initWebFITS: =>
+    @wfits.teardown() if @wfits?
+    
     @wfits = new astro.WebFITS(@el, @dimension)
 
     unless @wfits.ctx?

    lib = if context? then 'gl' else 'canvas'
    url = "javascripts/webfits-#{lib}.js"
    $.getScript(url, =>
      @initWebFITS()
      @dfs.webfits.resolve()
    )
  

  
  # Request FITS files for each channel
  requestChannels: ->
    @initWebFITS()
    
    # Set various deferred objects to handle asynchronous requests.
    @dfs =
