update cost and some else