Fix typo in response sorting function