Replication fixes

A sliceoff from https://github.com/apache/couchdb-fauxton/pull/50