Fix unhandled exception from attempting to pop the same value twice
from a dict