Fixed bug in getIntervals()