bug fix, missing KeyError in except clause