how can `ts` be zero? if it cannot, please remove the check