fixed some sorting syntax