a variety of small bug fixes