A bunch of bug fixes.