Fixed undefined uniq_id variable issue

The uniq_key variable is undefined in this context and this error comes up

`exceptions.NameError: global name 'uniq_key' is not defined`

This patch fixes the problem.