Fix cost calculation