A slew of bug fixes