Fixed structure and variable update in function replacement