Minor bugfix. Fixes the issue that statistics isn't preserved across
shut-downs and the issue that wrong task may got removed.