restore categories and functions