Fix filename detection.