fixed test cases failing in headless mode