implement replace check