Improved material loading including some error handling.