changes to make it build under "sage -sh"