Fix unit test in headless mode