Correctly sort hostnames, even if :hostname is missing