fixing some bug when editing multiple file(need testing).