change path replace logic