fix: fix possible null exception at task finishing