Fixes #6: In concurrent environment, the race condition occurs.

Fixes issue #6.