sorting output fixes #4