Fix a bug to replace it correctly