Better error handling for "buggy" input files