CFY-1604 improve input validations and tests.
CFY-1604 improve input validations and tests.