small bug fixes and style changes