fixed bugs in task.js

* * *

This commit was sponsored by Human JavaScript.
Human JavaScript is the best way to learn modern
web application development today, read it now:

http://go.hood.ie/human-javascript