keyerror_fix

it's not pretty but it should work