Fix message editing and header sorting