Fixed: replace function