fix KeyError