remove trailing . from basename