update profile.py, thread safe now