created single producer unit test and fixed some bugs