ensure arrays are always sorted when exported to yaml
more robust env pinning, fixes several edge case bugs.