Fix add function, replace id with cid