various small bug fixes
