add fo code to replace function