fixes for headless mode