add more utils in gc.c and fix some problem reported when compiling