variable $old_cat_ids might not be initialized