Replication fixes

A sliceoff from https://github.com/apache/couchdb-fauxton/pull/50
I would prefer that this is set `this.tasks = [];` at the beginning of this function. So we at least has some sort of value for it.