various minor bug fixes