change function order
fix invalid substituion as a list of lines