move check_consistency into utils (& tests)