fix test error with headless environment