Prevents dictionary changed size during iteration

Let's not pass the same dict object to a function that will potentially remove items from it, inside a for loop that is iterating over it, which will raise: RuntimeError: dictionary changed size during iteration.
This to be copied at this level to really errors.

Copying the dict inside the function call won't help because the same object is being assigned inside the loop, so it doesn't matter if copy was passed because we'll still get RuntimeError after assigning a changed dictionary.
Fixing typo introduced in last commit.
Merge pull request #23 from serpulga/patch-1

Prevents dictionary changed size during iteration