fix couch db error handloing