fixed singe thread problem