Corrrected some bugs in validator.py