Fixed bug with wrong replace