rewrite run task function