small bug fixes and improvements