bug corrected model_cat_gen.py