fix endedAt parsing bug