bug fixed: replace first and then split