Fixed undefined uniq_id variable issue