fixed: possible race condition