solved multi-thread problem