implemented replace()