fixed the c2pi bugs