added a missing KeyError catcher