Be more robust against matplotlib import issues