avoid possible race condition