update RythmEngine to make it threadsafe