Fix tiny bug with replace()