update max cost