Fixing code to fork on headless appropriately.