fix rest api sorting