Removing possible race condition