modify insertTab

increase efficiency of  insertTab