fix a bug in filename truncation