Fix target replacing