refactoring on file extension names
bug fix when a file cannot be opened