fixed the memory leak bug in CheckNaN