Handle case when sparse solver return nan result as scipy 0.13 did