cost model calculation: bug fixes