I would recommend checking the bug tracker for the already known and fixed issues. So, in this case the best way would be applying the latest hotfix no. 165:
Hotfix - Category-related errors when hotfixing projects with version 13.0.141 or older When updating a project from version 13.0.141 or older directly to 13.0.161 or newer, an error occurred during the hotfix procedure if the project's data contained one or more categories (defined in the Categories application). Such projects weren't updated correctly, and various category-related errors could occur.