Fix bugs for special characters in filename