replace synchronized code