added test for replaceOnce