fixed crash when the file cannot be open