Added unit test to reproduce multithreaded bug