Change box-shape judgement method. Fix gray color painting method.