Fix matplotlib running headless