add function exit replace end