Fixed a bug in CP code caused by a misused variable. There's still
another bug somewhere.