(Bug 5073) Fix various foundation issues