Fixed NaN issue