Fix epoch change detection