fix CPDI 3D bug, TO DO: debug CPDI2 2D, implement 3D