fix logsumexp in scipy for older versions