Fixed begindate detection logic bug.