fix bug with headless testing