Fix crash on headless servers