fix for python3 where dict_keys objects do not support indexes