add check condition for estimateCost