fix bug where the wrong timestamp was used