Fixed the mathlexer algorithm