fix problems with start/end tokens