fix bugs when set categories