before changing thread functions