More couchdb to postgres fixes