enforce sorting of keys so values don't get put in the wrong columns