Fixed NAN related bugs for Visual C++.