fix potential error when last_ts is faulty