Working around matplotlib problems