Fix exception catch when loading files