Fix bug related to scanning for header row