fixed the way result value is compared to the last one