fix to segfault on headless systems