Fix bug in creating timestamp