When periodBarriersCrossed is calculated the diff is casted to int making the result negative resulting in no archives being deleted. Have a test case which reproduces the issue.