fixed nan issue