solved problem with NaN values