making getRects functions return sorted_rects - bug fix