sorting works, but there is crash on exit sometimes. No idea why.