Sorting versions

The directory iterator is not guaranteed to return versions in order.