Fix a bug when updating task