Improved the line handlings for `insert.js`