update the function of writing dynamic