Improve thread state retention.