fix cost formula for patch