improve file loading error handling