debug and review CapValidator

several bugs fixed
Merge pull request #2 from HughChiou/Hugh-Chiou

debug and review CapValidator