Sort sub hash keys to have a stable ordering