fixed foreach_unique and local_atomics