Fix function couchdb