ModeMain: Fixed remove task handling, since an event can have the same
task multiple times.