fixed get_intervals