fixed a problem in the intervaction between dynamic threading and the emptiness check in the ts stack