sort metadata by key