Fix timestamp code