small bug fixes and cosmetics