Fix script error when editing task