Incorporate bug fixes from honest branch.