resolve sorting issue, fixes #1