modifying the api for edit category page and fixing some bugs