fix race condition when -U switch is used