fix latched values in if