fixed bug && improved formatTimestamp