fix buggy sort_key migration