improve error output, fix missing header row