Fix NaN which appeared in latest commit