Use static cast in tasks