better error reporting for file input