fixed the time expired undefined bug