small bug fixes and tweaks