fixes #23 sorting bug fix