Fixed problem with overlapping periods