Minor improvements in thread queue