Fixes Py3 related bug regarding dictionary element ordering.