Fixed bug in generating timestamps