Thread Bug fix