fixed bug (task not executed at shutdown)