added sorting of categories on default page and check before delete if has subcategories