fix bugs for category add function