     pageHtml += "</body></html>"
     fs.write 'result.html', pageHtml, 'w'
     @thenOpen "file://#{fs.workingDirectory}/result.html", ->
-        this.echo 'Resulting image saved to result.png'
-        this.capture 'result.png'
+        @echo 'Resulting image saved to result.png'
+        @capture 'result.png'
 
 # Capture carrousel area
 next = ->


# Building resulting page and image
buildPage = ->
    this.echo 'Build result page'
    fs = require 'fs'
    @viewport 624, 400
    pageHtml = "<html bgcolor=black><body>"

    if currentLink < nbLinks
        @click ".carousel_itemList_li[rel='#{currentLink}']"
        @wait 1000, ->
            @then next
            currentLink++
    else
        @then buildPage

casper.then next

