Added error handling for file import.