Take duration into account when filtering out invalid records