Fix bug when sanitizing filename.