implement replace operator