Code cleanup
Return the proper error message when the file format is wrong