Fixed issue with handling failed tasks