Update CPC, CPM function and fix bug