update records correctly