should be KeyError not IndexError