optimize replacement with fast method