fix bug with latestValue check