fixing NaN issue.