sorting with tinysort, minor fixes