fix the bug in cat_wrap.c