Added some extra logging for KeyError problem