fix the codes for thread safety