add categories and fix some bugs