Use sorted maps when generating tree hashes