Changed check_keys to raise an Exception