Fixed nick replacement function