matplotlib fails with thread problems