Fixed bug with set() in combination with replace()