Fixes bugs in MathToolsTest