Loading file with error checking.