improve timestamp handling