adding more robust consistancy checks.