Fixed adding to category.
Fixed adding the document to the same category multiple times.