only print the header when necessary.