Many and varied bug fixes