changed categories controller to fix the saving of category