fix for KeyError