Fixed a bug in ctpaint