There in lies your issue. Whatever script or process you did has not followed the proper procedure to write categories to the database nor did it perform all the functions our script does when it creates a category so your entire issue is centered around how you did this. One of those lessons learned I guess