KeyError fix