make sure to sort by the right var