small bug fixes, opt