Refactor Extension.fix/3
Clarify the logic and add test to ensure appending works when the file has no extension