Fix aggregate_max_prefix w/ test cases