fixed bug for scipy