Fixed a bug
added nX
fixed bugs for X and C