Record creation date / modification date of an item

It’s really strange as I don’t see any problems with the script. Is there any chance you have left empty rows inside the sheet and the new record is written to row 501 or 1001?