add f_length and changed close.c