Various fixes around UPDATE, DELETE and sorting.