fix save/update logic for tags and categories, code is still super messy though