Better KeyError exception error