fix constant in cost function