changed the logic function getValue0