sort element, in case of replace error.
update tasks