fix a few bugs with line reducer