Update Foundation, fix a few bugs.