fix add/remove category and cache clearing

Fixing the new add/remove category functions, which were not clearing cache properly.