Added exception for KeyError