Fix filename extension detection.