added task finish function