sort html output

I found the problem that generated HTML is not consistent on runs with the
same data. Reason is the new secure randomized hashes, where keys %hash
gives arrays with elements in different order.

I have added "sort" of the keys at two different places that makes my
current use case outputting consistent html.