fix headless issue properly