Fixes issue #80.

This addresses the issue with exports that break sort-order by making
sure that a sane subset of the original sort-order is applied.
Merge branch 'master' into 1.3.0