Close #280: save failed tasks into database