updated code that sliced dictionary keys, for Python 3 compatibility, closes #69