move check_consistency to utils.py