added cancel callback
if key is undefined don't serialize it in request to couch