Fix bug 2724, and convert to mathobject