move length function to base_file