a few small bug fixes