Third set of bug fixes