Task cleanup and a bug fix

Fixed bug when two messages overlapped