fixed slow performance problem in SimpleLexer; fixed small issues in tests