Replace dict modification with dict comprehension to avoid 3.4 bug.