fixed update_document to handle all keys as strings.