Fixed NAN issue