sort before render