Fix bug
Fix thread problem