[js] remove lines and signs while merging. fix bug with first pivot.