issue #1196 with a feeling of deja vu, I moved set_headless to just after argument passing.