rebuild base math dir