Updated onValueChange to return correct oldValue